package com.edu.chat.web.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @program: KQAIA
 * @description:
 * @author: 无恙
 * @create: 2025-03-17 14:32
 **/
@Configuration
@Data
public class MinioConfig {

	@Value("${minio.endpoint}")
	private String minioEndpoint;

	@Value("${minio.access-key}")
	private String minioAccessKey;

	@Value("${minio.secret-key}")
	private String minioSecretKey;

	@Value("${minio.bucketName}")
	private String bucketName;

	@Bean
	public MinioClient minioClient() {
		return MinioClient.builder()
				.endpoint(minioEndpoint)
				.credentials(minioAccessKey, minioSecretKey)
				.build();
	}
}
